package com.lhb.test.service;

import com.lhb.test.config.Pkg;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

@Service
public class ConsumerDemo {

    @RabbitListener(bindings = @QueueBinding(value = @Queue(value = Pkg.queue,durable = "false",autoDelete = "true"),
                   exchange = @Exchange(value = Pkg.exchange,ignoreDeclarationExceptions = "false",type = ExchangeTypes.TOPIC),key = Pkg.routing))
    public void Consumer(String name){
        System.out.println(name);
    }
}
